import React, {memo, useEffect, useState} from 'react';

const App = memo(() => {
  const [counter, setCounter] = useState(200);
  //副作用hook：传入一个回调函数，在每次组件渲染完成后会自动执行
  useEffect(() => {
    //网络请求、DOM操作、事件监听
    document.title = counter;
  });
  return (
    <div>
      <h2>当前计数：{counter}</h2>
      <button onClick={() => setCounter(counter + 1)}>+1</button>
    </div>
  )
})
export default App;
